﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class V2Controls_Profile_TextProperty : System.Web.UI.UserControl
{
    public string LabelText { get { return this.uiLblProperty.Text; } set { this.uiLblProperty.Text = value; } }
    public string Text { get { return this.uiTbProperty.Text; } set { this.uiTbProperty.Text = value; } }
    public int MaxLength { get { return this.uiTbProperty.MaxLength; } set { this.uiTbProperty.MaxLength = value; } }

    public bool IsRequired { get { return this.uiRfvProperty.Enabled; } set { this.uiRfvProperty.Enabled = value; } }

    public string MissingErrorMessage { get { return this.uiRfvProperty.ErrorMessage; } set { this.uiRfvProperty.ErrorMessage = value; } }
    public string WatermarkText { get { return this.uiTbweProperty.WatermarkText; } set { this.uiTbweProperty.WatermarkText = value; } }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int index = this.Parent.Controls.IndexOf(this);
            if (index >= 0)
            {
                int counter = 0;
                while (index > 0 && this.Parent.Controls[--index].GetType() == this.GetType())
                {
                    counter++;
                }

                if (((counter + 2) % 2) > 0)
                {
                    this.uiPnlProperty.CssClass = "propCA";
                }
            }
        }
    }
}
